package jman.competition14;

import java.sql.SQLException;

import javax.servlet.http.HttpSession;

public class UserService {
	static HttpSession session;
	public boolean login(String userName,String password) throws SQLException{
		boolean flag=false;
		UserDao ud=new UserDao();
		if(userName!=""&&password!=null){
			User user=ud.getUserByUserName(userName);
			if(password.equals(user.getPassword())){
				flag=true;
			}
		}
		return flag;
	}
	public boolean comment(String userName,String comment,int passageId){
		boolean flag=false;
		CommentAnnal c=new CommentAnnal(userName,comment,passageId);
		CommentDao cd=new CommentDao();
		flag=cd.addComment(c);
		return flag;
	}
}
